Repository navigation
fix: reject unsafe macOS ACLs on hook trust storage - #248
Conversation
|
No actionable comments were generated in the recent review. WalkthroughThe change rejects write-capable macOS ACLs on hook trust-storage paths and existing approval markers. CLI and generated Bash, Zsh, and Fish helpers use the shared ACL checker. The init cache schema advances to 14, with regression tests for ACL validation and renamed approval markers. ChangesHook trust storage
Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant EntryPoint as CLI or generated shell helper
participant TrustPath as _hooks_safe_trust_path
participant ACLCheck as _config_safety_acl_check
participant LS as ls
EntryPoint->>TrustPath: validate trust path
TrustPath->>ACLCheck: check root, directories, and marker ACLs
ACLCheck->>LS: inspect ACL with ls -lde
LS-->>ACLCheck: ACL entries or inspection failure
ACLCheck-->>TrustPath: pass or failure reason
TrustPath-->>EntryPoint: trusted or rejected
Possibly related PRs
Suggested reviewers: Merge Risk:
|
Description
A macOS ACL can grant write or rename access without changing Unix mode bits. Trust storage previously accepted such paths, allowing an existing user-owned approval marker to be renamed to the key for changed command definitions while retaining its valid canonical-config-path contents.
This change rejects write-capable ACLs on trust-store ancestors, the final directory, and existing markers. It shares the established Git-configuration ACL policy with the CLI and generated Bash/Zsh/Fish helpers, fails closed when ACL inspection fails, and advances the shell-integration cache schema to 14.
Motivation
Approval must remain bound to the command definitions the user reviewed. Read-only and deny ACLs, safe config-home symlinks, relative paths, and supported existing storage modes remain usable. The validation does not repair permissions or modify existing approvals.
Type of Change
Testing
9f99add: a renamed approval allowed the unreviewed hook to create its output file, and the generated Bash helper accepted ACL-writable storage. The regression tests pass after this fix../scripts/generate-completions.sh --checkandgit diff --checkpassed.Manual Testing Checklist
Tested on:
Core functionality tested:
git gtr new, including--porcelaingit gtr rmgit gtr trustTest Steps
In a disposable repository with temporary trust storage:
git gtr trustterminal prompt; create a worktree and verify its approved hook runs.skipped-untrusted.git gtr trust; verify it rejects unsafe storage without modifying the marker or ACL.Expected and actual behavior matched. The marker rename was simulated under the same OS account; a second-user attack was not executed. Safe inherited ACLs were also smoke-tested.
Breaking Changes
No new commands, dependencies, or configuration keys. Storage with write-capable macOS ACLs is now rejected; safe storage remains supported.
Checklist
CONTRIBUTING.mdand followed the project styleLicense Acknowledgment
This contribution is made under the terms of the Apache License 2.0.
Summary by CodeRabbit